from rest_framework import serializers
from .models import *


class CateSer(serializers.ModelSerializer):
    class Meta:
        model = Cate
        fields = "__all__"


class GoodsSer(serializers.ModelSerializer):
    # 序列化嵌套
    # cate = CateSer()

    class Meta:
        model = Goods
        fields = "__all__"


class GoodsListSer(serializers.ModelSerializer):
    class Meta:
        model = Goods
        fields = ["id", "name", "pic", "price", "unit"]
